import { S, U, getRequestId, mapField } from '../../lib/backend'
import Q from 'q'
import axios from 'axios'
import envFuncs from '@/config/base'
let env = envFuncs.getParams()

export default {
  // 获取sms
  getPerformances ({ commit, rootState }, info) {
    const params = U(info)
    const CRM_API_HOST = env.CRM_API_HOST
    // const CRM_API_HOST = 'http://rapapi.local:8800/mockjsdata/1'
    return axios.get(
      CRM_API_HOST + '/users/' + rootState.app.token + '/achievements/sales?' + params
    )
  },
  undoOrder ({ commit, rootState }, info) {
    // const params = S(info, false)
    const CRM_API_HOST = env.CRM_API_HOST
    // const CRM_API_HOST = 'http://rapapi.local:8800/mockjsdata/1'
    return axios.post(
      CRM_API_HOST + '/users/' + rootState.app.token + '/achievements/sales/'+ info.order_sn +'/cancel'
    )
  }
}
